import{ useState } from 'react'
function Dog() {
    // let a = false
    let [isBarking, serIsBarking] = useState(false)
    let [isRunning, serIsRunning] = useState(false)
    const handleClick = () => {
        // DOM 编程已经一去不复返了
        serIsBarking(true)
        serIsRunning(true)
        // a=true
        setTimeout(() => {
            serIsBarking(false),
            serIsRunning(false)
        }, 1000)
            
        
    }
    
    return (
        // 动态  多个状态
        <div onClick={handleClick}>
            <div>Dog</div>
            <p>{isBarking && '汪汪汪'}</p>
            <p>{isRunning && '爬爬爬'}</p>
        </div>
    )
}

export default Dog